import { observable, action, makeObservable } from "mobx";
import { PageDateSelect } from '@/types/pages/enum'
import { ICustomerFull } from "@/types/pages/customer/interface";
import { getTransportCarriageData,
    getTransportCostsData,
    getCategoryPieChart,
    getAccountsT10ColumnChart,
    getProfitT10ColumnChart,
    getTendencyLineChart
} from "@/api/transportCosts";
import { ITransportCostsFull } from "@/types/pages/transportCosts/interface";
import { IStore } from "@/types/pages/base";

/**
 * class TransportCosts
 * 物流费用
 */
class TransportCosts  implements IStore<ITransportCostsFull>  {
    @observable screenData :ITransportCostsFull= {
        transportCarriage: {}, transportCosts: {}, categoryPie: {},
        accountsT10Column: {}, profitT10Column: {}, tendencyLine: {}
    }

    constructor() {
      makeObservable(this)
  }
   /**
     *
     * @param type 日期选择函数
     * @param date 传入日期
     */
     @action async getScreenData(type: PageDateSelect,date?:Date) {
        // 获取左上部分
        this.screenData.transportCarriage= await getTransportCarriageData(type,date);
        this.screenData.transportCosts= await getTransportCostsData(type,date);
        this.screenData.categoryPie= await getCategoryPieChart(type,date);
        this.screenData.accountsT10Column= await getAccountsT10ColumnChart(type,date);
        this.screenData.profitT10Column= await getProfitT10ColumnChart(type,date);
        this.screenData.tendencyLine= await getTendencyLineChart(type,date);
        return  this.screenData;
    }


}
export default TransportCosts;
